package com.erp.erp_ui.supplier;


import com.erp.erp_entitys.Supplier.SupplierEntity;
import com.erp.erp_servers.supplier.ISupplierServers;
import com.erp.erp_ui.base.Base;
import com.erp.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SupplierControl
 * @Description 测试用例类
 * @Author songjizhen
 * @Date 2020/6/17 14:02
 * @Version 1.0
 */
@Controller
@RequestMapping(value = "supplier")
 public class SupplierControl extends Base {
    @Autowired
    private ISupplierServers supplierServers;

    /**
     * 跳转到index 页面
     * @return
     */
    @RequestMapping(value = "open")
    public String open(){
        return "index";
    }
    /**
     * 不分页获取所有数据
     * @return
     */
    @RequestMapping(value = "getAllSupplier")
    @ResponseBody
    public R getAllSupplier(){
        List<SupplierEntity> suppliers = supplierServers.selectSupplier();
        return R.build(suppliers);
    }
    /**
     * 分页获取所有数据
     * @return
     */
    @RequestMapping("/UsersByPage")
    @ResponseBody
     public R<List<SupplierEntity>>  getUsersByPage() {
        List<SupplierEntity> list = supplierServers.UsersByPage();
        return R.build(list);
    }
    @RequestMapping("/gettoken")
    @ResponseBody

    public R gettoken(){
        Map<String,String> map=new HashMap<String,String>();
        map.put("token","122daskjfla");
        return R.build(map);
    }
}